<div ng-controller="StepfreightCtrl" ng-init="addAction()">
    <ul class="sui-breadcrumb">
        <li><a href="#/stepfreight/list">{{'阶梯运费'| translate}}</a></li>
        <li class="active">
            {{"创建"|translate}}
        </li>
    </ul>
    <div class="sui-form form-horizontal">
        <div class="control-group">
            <label class="control-label v-top">
                基础运费：
            </label>
            <div class="controls">
                <input id="base_fee" type="number" name="base_fee" ng-model="stepData.base_fee" /> 元
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">
                距离额外配送：
            </label>
            <div class="controls">
                <div ng-repeat="(key, value) in stepData.distance_fees" style="margin-bottom: 10px;">
                    <span>
                        <input type="number" class="sui-inpu input-small" ng-model="value.lower" /> 公里
                    </span>
                    <span> 到 </span>
                    <span>
                        <input type="number" class="sui-input input-small" ng-model="value.upper"> 公里
                    </span>
                    <span>
                        每 <input type="number" class="sui-input input-small" ng-model="value.unit"> 公里，
                    </span>
                    <span>
                        增加 <input type="text" class="sui-input input-small" ng-model="value.unit_fee"> 元
                    </span>
                    <span ng-show="!freight_rule_id">
                        <button class="sui-btn btn-link" ng-click="deleteDistance($index)">删除</button>
                    </span>
                </div>
                <div ng-show="!freight_rule_id">
                    <button class="sui-btn btn-link" ng-click="addDistance()" style="margin-left: -10px;">+增加距离附加费</button>
                </div>
                <div class="sui-msg msg-info">
                  <div class="msg-con">每多少公里数设置为0的时候，则代表这个区间的价格就是增加的金额</div>
                  <s class="msg-icon"></s>
                </div>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">
                重量额外配送：
            </label>
            <div class="controls">
                <div ng-repeat="(key, value) in stepData.weight_fees" style="margin-bottom: 10px;">
                    <span>
                        <input type="number" class="sui-inpu input-small" ng-model="value.lower" /> 公斤
                    </span>
                    <span> 到 </span>
                    <span>
                        <input type="number" class="sui-input input-small" ng-model="value.upper"> 公斤
                    </span>
                    <span>
                        每 <input type="number" class="sui-input input-small" ng-model="value.unit"> 公斤，
                    </span>
                    <span>
                        增加 <input type="text" class="sui-input input-small" ng-model="value.unit_fee"> 元
                    </span>
                    <span ng-show="!freight_rule_id">
                        <button class="sui-btn btn-link" ng-click="deleteWeight($index)">删除</button>
                    </span>
                </div>
                <div ng-show="!freight_rule_id">
                    <button class="sui-btn btn-link" ng-click="addWeight(key)" style="margin-left: -10px;">+增加重量附加费</button>
                </div>
                <div class="sui-msg msg-info">
                  <div class="msg-con">每多少公斤数设置为0的时候，则代表这个区间的价格就是增加的金额</div>
                  <s class="msg-icon"></s>
                </div>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">
                时段额外配送：
            </label>
            <div class="controls">
                <div ng-repeat="(key, value) in stepData.period_fees" style="margin-bottom: 10px;">
                    <span>
                        <input type="text" data-toggle="timepicker" class="sui-inpu input-small" ng-model="value.start" />
                    </span>
                    <span> 到 </span>
                    <span>
                        <input type="text" data-toggle="timepicker" class="sui-input input-small" ng-model="value.end">
                    </span>
                    <span>
                        增加 <input type="text" class="sui-input input-small" ng-model="value.unit_fee"> 元
                    </span>
                    <span ng-show="!freight_rule_id">
                        <button class="sui-btn btn-link" ng-click="deletePeriod($index)">删除</button>
                    </span>
                </div>
                <div ng-show="!freight_rule_id">
                    <button class="sui-btn btn-link" ng-click="addPeriod(key)" style="margin-left: -10px;">+增加时段附加费</button>
                </div>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label"></label>
            <div class="controls">
                <button id="submit" class="sui-btn btn-primary" ng-disabled="(!stepData.distance_fees.length && !stepData.weight_fees.length && !stepData.period_fees.length)" ng-click="stepfreightAdd()">
                    <span>{{'save'|translate}}</span>
                </button>
            </div>
        </div>
    </div>
</div>